package ch07_GUI编程;

import javax.swing.*;
import java.awt.*;

public class JToolBarDemo {
	public static void main(String[] args) {
		BaseFrame f = new BaseFrame("JToolBar Demo");

		JToolBar bar = new JToolBar("导航", SwingConstants.HORIZONTAL);
		String[] icons = { "first.png", "pre.png", "next.png", "last.png" };
		JButton[] btns = new JButton[icons.length];

		for (int i = 0; i < btns.length; i++) {
			ImageIcon icon = ImageFactory.create(icons[i]);
			btns[i] = new JButton();
			btns[i].setIcon(icon);
			bar.add(btns[i]);
		}
		bar.addSeparator();
		bar.add(new JLabel("搜索"));
		bar.add(new JTextField());
		bar.setFloatable(true);

		f.setLayout(new BorderLayout());
		f.add(bar, BorderLayout.NORTH);
		f.showMe();
	}
}
